import FlyIO from 'flyio/dist/npm/wx.js'
import store from '@/store/index'
const http = new FlyIO()

http.config.baseURL = 'http://cba.itlike.com/public/index.php?s=/api/'

http.config.timeout = 15000

http.interceptors.request.use((options) => {
  if (store.getters.token) {
    options.headers = {
      'Access-Token': store.getters.token,
      platform: 'H5'
    }
  }
  return options
})

http.interceptors.response.use((response) => {
  
  return response.data
}, (error) => {
  return Promise.reject(error)
})

export default http